package com.bonc.cq.cloud.controller;
import com.alibaba.fastjson.JSONObject;
import com.bonc.cq.cloud.feign.InstanceFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/instanceFeign")
public class InstanceFeignController {

    @Autowired
    private InstanceFeignClient client;

    @Value("${server.port}")
    private String port;

    @GetMapping("/getInstance/{serviceId}")
    public JSONObject getInstance(@PathVariable String serviceId){
        JSONObject json = client.getInstance(serviceId);
        json.put("consumer port",port);
        return json;
    }
}
